<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <f:metadata>
            <f:viewParam name="patientID" value="#{patientBean.patientID}"/>
            <f:viewParam name="patientID" value="#{sessionBean.patientID}"/>
            <f:viewParam name="message" value="#{patientBean.message}"/>
            <f:viewParam name="messageStyle" value="#{patientBean.messageStyle}"/>
            <f:event type="preRenderView" listener="#{patientBean.getPatientDetail}"/>
        </f:metadata>   
    </h:head>
    <h:body>
        <ui:composition template="template/masterlayout.xhtml">
            <ui:define name="pagetitle">
                #{patientBean.patientName}
            </ui:define>
            <ui:define name="breadcrumb">
                <h:link value="Dashboard" outcome="index"/> &raquo; <h:link value="Patients management" outcome="patients"/> &raquo; <h:outputText value="#{patientBean.patientName}"/>
            </ui:define>
            <ui:define name="content">
                <div class="alert-box #{patientBean.messageStyle}"><span>#{patientBean.messageStyle} </span>#{patientBean.message}</div>
                <div class="druginfo detail">
                    <div class="thumb">
                        <h:graphicImage library="images" name="noimage.jpg"/>
                    </div>
                    <div class="bref">
                        <p>                            
                            <h:outputLabel for="patientID">Patient ID: </h:outputLabel>
                            <h:outputText id="patientID" value="#{patientBean.patientID}"/>
                        </p>                        
                        <p>                            
                            <h:outputLabel for="patientName">Patient Name: </h:outputLabel>
                            <h:outputText id="patientName" value="#{patientBean.patientName}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientSex">Patient Sex: </h:outputLabel>
                            <h:outputText id="patientSex" value="#{patientBean.patientSex}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientDateOfBirth">Patient Date Of Birth: </h:outputLabel>
                            <h:outputText id="patientDateOfBirth" value="#{patientBean.patientDateOfBirth}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientJob">Patient Job: </h:outputLabel>
                            <h:outputText id="patientJob" value="#{patientBean.patientJob}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientAddress">Patient Address: </h:outputLabel>
                            <h:outputText id="patientAddress" value="#{patientBean.patientAddress}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientPhoneNumber">Patient Phone Number: </h:outputLabel>
                            <h:outputText id="patientPhoneNumber" value="#{patientBean.patientPhoneNumber}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientEmail">Patient email: </h:outputLabel>
                            <h:outputText id="patientEmail" value="#{patientBean.patientEmail}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientHeight">Patient Height: </h:outputLabel>
                            <h:outputText id="patientHeight" value="#{patientBean.patientHeight}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientWeight">Patient Weight: </h:outputLabel>
                            <h:outputText id="patientWeight" value="#{patientBean.patientWeight}"/>
                        </p>
                        <p>                            
                            <h:outputLabel for="patientBloodType">Patient Blood Type: </h:outputLabel>
                            <h:outputText id="patientBloodType" value="#{patientBean.patientBloodType}"/>
                        </p>                        
                    </div>
                    <div class="clear">                        
                    </div>
                    <h:link styleClass="button-submit" value="Add new session" outcome="addsession">
                        <f:param name="patientID" value="#{patientBean.patientID}"/>                        
                    </h:link>
                </div>
                <h:form>
                    <h:dataTable value="#{sessionBean.sessions}" var="sessionpatient" columnClasses="date,doctor,action">
                    <h:column>
                        <f:facet name="header">Date</f:facet>
                        #{sessionpatient.sessionDate}
                    </h:column>
                    <h:column>
                        <f:facet name="header">Doctor</f:facet>
                        #{sessionpatient.doctor}
                    </h:column>
                    <h:column>
                        <f:facet name="header">Action</f:facet>
                        <h:link styleClass="view" value="View" outcome="session">
                            <f:param name="sessionID" value="#{sessionpatient.sessionID}"/>
                        </h:link>
                        <h:link styleClass="edit" value="Edit" outcome="editsession">
                            <f:param name="sessionID" value="#{sessionpatient.sessionID}"/>
                        </h:link>
                        <h:commandLink styleClass="delete" value="Delete" action="#{sessionBean.deleteSession(sessionpatient.sessionID)}"></h:commandLink>
                    </h:column>
                </h:dataTable>                    
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

